/*
 * Copyright (c)  2018, XiQiao
 * All rights reserved. 
 *
 * Id:ExcelPropertyComparator.java   2018-07-28 23:40 wanglijun
 */
package io.marmot.poi.domain;

import io.marmot.poi.domain.ExcelProperty;

import java.util.Comparator;

/**
 * <p>
 * Title: Excel 字段显示排序
 * </p>
 * <p>
 * Description:字段显示排序
 * </p>
 * <p>
 * Copyright: Copyright (c) 2018
 * </p>
 * <p>
 * Company: XiQiao
 * </p>
 *
 * @author: wanglijun
 * @create: 2018-07-28 23:40
 * @version：1.0
 */
public class ExcelPropertyComparator implements Comparator<ExcelProperty> {


    @Override
    public int compare(ExcelProperty o1, ExcelProperty o2) {
        if (o1.getOrder ().equals (o2.getOrder())) {
            return o1.getName ().compareToIgnoreCase (o2.getName());
        }
        return o1.getOrder().compareTo (o2.getOrder ());
    }
}
